﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Xml;
using LibHuman;

namespace Human
{
	/// <summary>
	/// Summary description for frmThongso.
	/// </summary>
	public class frmThongso : System.Windows.Forms.Form
	{

        string m_user = "";
        private AccessData mDB = new AccessData();
		private DataSet ds =new DataSet();
		private System.Windows.Forms.TextBox txtPath;
		private System.Windows.Forms.Button Opendata;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button cmdOK;
		private System.Windows.Forms.Button cmdClose;
        private System.Windows.Forms.CheckBox chkMang;
        private TabPage tabPage2;
        private DateTimePicker c138;
        private Label label34;
        private TabPage tabPage1;
        private Label label16;
        private Label label10;
        private ComboBox matt;
        private CheckBox chkdgkqcc;
        private TextBox dienthoai;
        private Label label11;
        private Label label9;
        private TextBox txt_giamdoccty;
        private Label label6;
        private TextBox txtGiamdoc;
        private TextBox txt_tylebh_bv;
        private TextBox txt_tylebh_nv;
        private TextBox txt_xephang;
        private TextBox diachi;
        private GroupBox groupBox1;
        private Label label14;
        private Label label15;
        private Label label12;
        private Label label5;
        private CheckBox chkATM;
        private ComboBox benhvien;
        private Label label8;
        private Label label4;
        private Label label7;
        private TextBox soyte;
        private TextBox txtltt;
        private Label label3;
        private CheckBox chkVantay;
        private ComboBox maqu;
        private CheckBox chkBarcode;
        private Label label13;
        private Label label2;
        private TabControl tabCtlThongso;
        private TextBox txt_tylethuviec;
        private Label label17;
        private Label label18;
        private CheckBox chk_cccuoituan;
        private Label label20;
        private Label label19;
        private TextBox txt_nguoilb;
        private TextBox txt_tptochuc;
        private TextBox txt_website;
        private TextBox txt_fax;
        private Label label21;
        private Label label22;
        private DateTimePicker dtp_gioccchieu;
        private Label label23;
        private CheckBox chk_nhapmacc;
        private CheckBox chk_cctructc;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmThongso()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmThongso));
            this.chkMang = new System.Windows.Forms.CheckBox();
            this.txtPath = new System.Windows.Forms.TextBox();
            this.Opendata = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.cmdOK = new System.Windows.Forms.Button();
            this.cmdClose = new System.Windows.Forms.Button();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.dtp_gioccchieu = new System.Windows.Forms.DateTimePicker();
            this.c138 = new System.Windows.Forms.DateTimePicker();
            this.label23 = new System.Windows.Forms.Label();
            this.label34 = new System.Windows.Forms.Label();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.chk_cctructc = new System.Windows.Forms.CheckBox();
            this.chk_nhapmacc = new System.Windows.Forms.CheckBox();
            this.chk_cccuoituan = new System.Windows.Forms.CheckBox();
            this.label18 = new System.Windows.Forms.Label();
            this.label16 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.matt = new System.Windows.Forms.ComboBox();
            this.chkdgkqcc = new System.Windows.Forms.CheckBox();
            this.txt_website = new System.Windows.Forms.TextBox();
            this.txt_fax = new System.Windows.Forms.TextBox();
            this.dienthoai = new System.Windows.Forms.TextBox();
            this.label20 = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.label19 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.txt_nguoilb = new System.Windows.Forms.TextBox();
            this.txt_giamdoccty = new System.Windows.Forms.TextBox();
            this.label21 = new System.Windows.Forms.Label();
            this.label22 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.txt_tptochuc = new System.Windows.Forms.TextBox();
            this.txtGiamdoc = new System.Windows.Forms.TextBox();
            this.txt_tylebh_bv = new System.Windows.Forms.TextBox();
            this.txt_tylebh_nv = new System.Windows.Forms.TextBox();
            this.txt_tylethuviec = new System.Windows.Forms.TextBox();
            this.txt_xephang = new System.Windows.Forms.TextBox();
            this.diachi = new System.Windows.Forms.TextBox();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.label17 = new System.Windows.Forms.Label();
            this.label14 = new System.Windows.Forms.Label();
            this.label15 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.chkATM = new System.Windows.Forms.CheckBox();
            this.benhvien = new System.Windows.Forms.ComboBox();
            this.label8 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.soyte = new System.Windows.Forms.TextBox();
            this.txtltt = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.chkVantay = new System.Windows.Forms.CheckBox();
            this.maqu = new System.Windows.Forms.ComboBox();
            this.chkBarcode = new System.Windows.Forms.CheckBox();
            this.label13 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.tabCtlThongso = new System.Windows.Forms.TabControl();
            this.tabPage2.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.tabCtlThongso.SuspendLayout();
            this.SuspendLayout();
            // 
            // chkMang
            // 
            this.chkMang.Location = new System.Drawing.Point(96, 383);
            this.chkMang.Name = "chkMang";
            this.chkMang.Size = new System.Drawing.Size(200, 16);
            this.chkMang.TabIndex = 41;
            this.chkMang.Text = "Sử dụng cơ sỡ dữ liệu trên mạng";
            this.chkMang.CheckedChanged += new System.EventHandler(this.chkMang_CheckedChanged);
            // 
            // txtPath
            // 
            this.txtPath.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtPath.Enabled = false;
            this.txtPath.Location = new System.Drawing.Point(96, 405);
            this.txtPath.Name = "txtPath";
            this.txtPath.Size = new System.Drawing.Size(445, 20);
            this.txtPath.TabIndex = 42;
            // 
            // Opendata
            // 
            this.Opendata.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Opendata.Location = new System.Drawing.Point(547, 402);
            this.Opendata.Name = "Opendata";
            this.Opendata.Size = new System.Drawing.Size(24, 24);
            this.Opendata.TabIndex = 43;
            this.Opendata.Text = "...";
            this.Opendata.Click += new System.EventHandler(this.Opendata_Click);
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(5, 408);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(88, 16);
            this.label1.TabIndex = 44;
            this.label1.Text = "Đường dẫn data:";
            // 
            // cmdOK
            // 
            this.cmdOK.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cmdOK.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.cmdOK.Image = ((System.Drawing.Image)(resources.GetObject("cmdOK.Image")));
            this.cmdOK.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.cmdOK.Location = new System.Drawing.Point(224, 332);
            this.cmdOK.Name = "cmdOK";
            this.cmdOK.Size = new System.Drawing.Size(80, 28);
            this.cmdOK.TabIndex = 22;
            this.cmdOK.Text = "&Cập nhật";
            this.cmdOK.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
            // 
            // cmdClose
            // 
            this.cmdClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cmdClose.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.cmdClose.Image = ((System.Drawing.Image)(resources.GetObject("cmdClose.Image")));
            this.cmdClose.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.cmdClose.Location = new System.Drawing.Point(310, 332);
            this.cmdClose.Name = "cmdClose";
            this.cmdClose.Size = new System.Drawing.Size(80, 28);
            this.cmdClose.TabIndex = 23;
            this.cmdClose.Text = "Kết thúc";
            this.cmdClose.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.cmdClose.Click += new System.EventHandler(this.cmdClose_Click);
            // 
            // tabPage2
            // 
            this.tabPage2.Controls.Add(this.dtp_gioccchieu);
            this.tabPage2.Controls.Add(this.c138);
            this.tabPage2.Controls.Add(this.label23);
            this.tabPage2.Controls.Add(this.label34);
            this.tabPage2.Location = new System.Drawing.Point(4, 22);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage2.Size = new System.Drawing.Size(571, 299);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "Chấm công";
            this.tabPage2.UseVisualStyleBackColor = true;
            // 
            // dtp_gioccchieu
            // 
            this.dtp_gioccchieu.CustomFormat = "HH:mm";
            this.dtp_gioccchieu.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.dtp_gioccchieu.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
            this.dtp_gioccchieu.Location = new System.Drawing.Point(184, 41);
            this.dtp_gioccchieu.Name = "dtp_gioccchieu";
            this.dtp_gioccchieu.Size = new System.Drawing.Size(56, 21);
            this.dtp_gioccchieu.TabIndex = 118;
            // 
            // c138
            // 
            this.c138.CustomFormat = "HH:mm";
            this.c138.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.c138.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
            this.c138.Location = new System.Drawing.Point(184, 15);
            this.c138.Name = "c138";
            this.c138.Size = new System.Drawing.Size(56, 21);
            this.c138.TabIndex = 118;
            // 
            // label23
            // 
            this.label23.AutoSize = true;
            this.label23.ForeColor = System.Drawing.Color.DarkBlue;
            this.label23.Location = new System.Drawing.Point(13, 45);
            this.label23.Name = "label23";
            this.label23.Size = new System.Drawing.Size(174, 13);
            this.label23.TabIndex = 117;
            this.label23.Text = "Giờ bắt đầu chấm công buổi chiều:";
            this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label34
            // 
            this.label34.AutoSize = true;
            this.label34.ForeColor = System.Drawing.Color.DarkBlue;
            this.label34.Location = new System.Drawing.Point(13, 19);
            this.label34.Name = "label34";
            this.label34.Size = new System.Drawing.Size(127, 13);
            this.label34.TabIndex = 117;
            this.label34.Text = "Giờ kết thúc chấm công :";
            this.label34.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // tabPage1
            // 
            this.tabPage1.Controls.Add(this.chk_cctructc);
            this.tabPage1.Controls.Add(this.chk_nhapmacc);
            this.tabPage1.Controls.Add(this.chk_cccuoituan);
            this.tabPage1.Controls.Add(this.label18);
            this.tabPage1.Controls.Add(this.label16);
            this.tabPage1.Controls.Add(this.label10);
            this.tabPage1.Controls.Add(this.matt);
            this.tabPage1.Controls.Add(this.chkdgkqcc);
            this.tabPage1.Controls.Add(this.txt_website);
            this.tabPage1.Controls.Add(this.txt_fax);
            this.tabPage1.Controls.Add(this.dienthoai);
            this.tabPage1.Controls.Add(this.label20);
            this.tabPage1.Controls.Add(this.label11);
            this.tabPage1.Controls.Add(this.label19);
            this.tabPage1.Controls.Add(this.label9);
            this.tabPage1.Controls.Add(this.txt_nguoilb);
            this.tabPage1.Controls.Add(this.txt_giamdoccty);
            this.tabPage1.Controls.Add(this.label21);
            this.tabPage1.Controls.Add(this.label22);
            this.tabPage1.Controls.Add(this.label6);
            this.tabPage1.Controls.Add(this.txt_tptochuc);
            this.tabPage1.Controls.Add(this.txtGiamdoc);
            this.tabPage1.Controls.Add(this.txt_tylebh_bv);
            this.tabPage1.Controls.Add(this.txt_tylebh_nv);
            this.tabPage1.Controls.Add(this.txt_tylethuviec);
            this.tabPage1.Controls.Add(this.txt_xephang);
            this.tabPage1.Controls.Add(this.diachi);
            this.tabPage1.Controls.Add(this.groupBox1);
            this.tabPage1.Controls.Add(this.label17);
            this.tabPage1.Controls.Add(this.label14);
            this.tabPage1.Controls.Add(this.label15);
            this.tabPage1.Controls.Add(this.label12);
            this.tabPage1.Controls.Add(this.label5);
            this.tabPage1.Controls.Add(this.chkATM);
            this.tabPage1.Controls.Add(this.benhvien);
            this.tabPage1.Controls.Add(this.label8);
            this.tabPage1.Controls.Add(this.label4);
            this.tabPage1.Controls.Add(this.label7);
            this.tabPage1.Controls.Add(this.soyte);
            this.tabPage1.Controls.Add(this.txtltt);
            this.tabPage1.Controls.Add(this.label3);
            this.tabPage1.Controls.Add(this.chkVantay);
            this.tabPage1.Controls.Add(this.maqu);
            this.tabPage1.Controls.Add(this.chkBarcode);
            this.tabPage1.Controls.Add(this.label13);
            this.tabPage1.Controls.Add(this.label2);
            this.tabPage1.Location = new System.Drawing.Point(4, 22);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage1.Size = new System.Drawing.Size(571, 299);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "Nhân sự";
            this.tabPage1.UseVisualStyleBackColor = true;
            // 
            // chk_cctructc
            // 
            this.chk_cctructc.AutoSize = true;
            this.chk_cctructc.ForeColor = System.Drawing.Color.DarkBlue;
            this.chk_cctructc.Location = new System.Drawing.Point(257, 216);
            this.chk_cctructc.Name = "chk_cctructc";
            this.chk_cctructc.Size = new System.Drawing.Size(158, 17);
            this.chk_cctructc.TabIndex = 19;
            this.chk_cctructc.Text = "Chấm công trực tăng cường";
            this.chk_cctructc.UseVisualStyleBackColor = true;
            this.chk_cctructc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.chk_cctructc_KeyDown);
            // 
            // chk_nhapmacc
            // 
            this.chk_nhapmacc.AutoSize = true;
            this.chk_nhapmacc.ForeColor = System.Drawing.Color.DarkBlue;
            this.chk_nhapmacc.Location = new System.Drawing.Point(93, 216);
            this.chk_nhapmacc.Name = "chk_nhapmacc";
            this.chk_nhapmacc.Size = new System.Drawing.Size(134, 17);
            this.chk_nhapmacc.TabIndex = 18;
            this.chk_nhapmacc.Text = "Nhập mã cc nhân viên";
            this.chk_nhapmacc.UseVisualStyleBackColor = true;
            this.chk_nhapmacc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.chk_nhapmacc_KeyDown);
            // 
            // chk_cccuoituan
            // 
            this.chk_cccuoituan.AutoSize = true;
            this.chk_cccuoituan.ForeColor = System.Drawing.Color.DarkBlue;
            this.chk_cccuoituan.Location = new System.Drawing.Point(93, 194);
            this.chk_cccuoituan.Name = "chk_cccuoituan";
            this.chk_cccuoituan.Size = new System.Drawing.Size(153, 17);
            this.chk_cccuoituan.TabIndex = 15;
            this.chk_cccuoituan.Text = "Chấm công ngày cuối tuần\r\n";
            this.chk_cccuoituan.UseVisualStyleBackColor = true;
            this.chk_cccuoituan.CheckedChanged += new System.EventHandler(this.chk_cccuoituan_CheckedChanged);
            this.chk_cccuoituan.KeyDown += new System.Windows.Forms.KeyEventHandler(this.chk_cccuoituan_KeyDown);
            // 
            // label18
            // 
            this.label18.Location = new System.Drawing.Point(200, 140);
            this.label18.Name = "label18";
            this.label18.Size = new System.Drawing.Size(21, 23);
            this.label18.TabIndex = 47;
            this.label18.Text = "%";
            this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // label16
            // 
            this.label16.Location = new System.Drawing.Point(536, 138);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(21, 23);
            this.label16.TabIndex = 46;
            this.label16.Text = "%";
            this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // label10
            // 
            this.label10.Location = new System.Drawing.Point(536, 113);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(21, 23);
            this.label10.TabIndex = 46;
            this.label10.Text = "%";
            this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // matt
            // 
            this.matt.BackColor = System.Drawing.SystemColors.HighlightText;
            this.matt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.matt.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.matt.Location = new System.Drawing.Point(93, 13);
            this.matt.Name = "matt";
            this.matt.Size = new System.Drawing.Size(200, 21);
            this.matt.TabIndex = 0;
            this.matt.SelectedIndexChanged += new System.EventHandler(this.matt_SelectedIndexChanged);
            this.matt.KeyDown += new System.Windows.Forms.KeyEventHandler(this.matt_KeyDown);
            // 
            // chkdgkqcc
            // 
            this.chkdgkqcc.ForeColor = System.Drawing.Color.DarkBlue;
            this.chkdgkqcc.Location = new System.Drawing.Point(376, 190);
            this.chkdgkqcc.Name = "chkdgkqcc";
            this.chkdgkqcc.Size = new System.Drawing.Size(191, 24);
            this.chkdgkqcc.TabIndex = 17;
            this.chkdgkqcc.Text = "Xem đánh giá cán bộ công chức ";
            this.chkdgkqcc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.chkdgkqcc_KeyDown);
            // 
            // txt_website
            // 
            this.txt_website.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_website.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_website.Location = new System.Drawing.Point(377, 63);
            this.txt_website.Name = "txt_website";
            this.txt_website.Size = new System.Drawing.Size(190, 21);
            this.txt_website.TabIndex = 5;
            this.txt_website.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_website_KeyDown);
            // 
            // txt_fax
            // 
            this.txt_fax.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_fax.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_fax.Location = new System.Drawing.Point(377, 88);
            this.txt_fax.Name = "txt_fax";
            this.txt_fax.Size = new System.Drawing.Size(159, 21);
            this.txt_fax.TabIndex = 7;
            this.txt_fax.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_fax_KeyDown);
            // 
            // dienthoai
            // 
            this.dienthoai.BackColor = System.Drawing.SystemColors.HighlightText;
            this.dienthoai.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.dienthoai.Location = new System.Drawing.Point(93, 89);
            this.dienthoai.Name = "dienthoai";
            this.dienthoai.Size = new System.Drawing.Size(200, 21);
            this.dienthoai.TabIndex = 6;
            this.dienthoai.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dienthoai_KeyDown);
            // 
            // label20
            // 
            this.label20.ForeColor = System.Drawing.Color.DarkBlue;
            this.label20.Location = new System.Drawing.Point(299, 274);
            this.label20.Name = "label20";
            this.label20.Size = new System.Drawing.Size(99, 22);
            this.label20.TabIndex = 45;
            this.label20.Text = "Người lập biểu:";
            this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label11
            // 
            this.label11.ForeColor = System.Drawing.Color.DarkBlue;
            this.label11.Location = new System.Drawing.Point(299, 248);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(99, 22);
            this.label11.TabIndex = 45;
            this.label11.Text = "Giám đốc công ty:";
            this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label19
            // 
            this.label19.ForeColor = System.Drawing.Color.DarkBlue;
            this.label19.Location = new System.Drawing.Point(10, 274);
            this.label19.Name = "label19";
            this.label19.Size = new System.Drawing.Size(114, 22);
            this.label19.TabIndex = 45;
            this.label19.Text = "Trưởng phòng:";
            this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label9
            // 
            this.label9.ForeColor = System.Drawing.Color.DarkBlue;
            this.label9.Location = new System.Drawing.Point(10, 248);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(114, 22);
            this.label9.TabIndex = 45;
            this.label9.Text = "Giám đốc bệnh viện:";
            this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txt_nguoilb
            // 
            this.txt_nguoilb.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_nguoilb.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_nguoilb.Location = new System.Drawing.Point(404, 274);
            this.txt_nguoilb.Name = "txt_nguoilb";
            this.txt_nguoilb.Size = new System.Drawing.Size(161, 21);
            this.txt_nguoilb.TabIndex = 23;
            this.txt_nguoilb.Validated += new System.EventHandler(this.txt_nguoilb_Validated);
            this.txt_nguoilb.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_nguoilb_KeyDown);
            // 
            // txt_giamdoccty
            // 
            this.txt_giamdoccty.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_giamdoccty.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_giamdoccty.Location = new System.Drawing.Point(404, 248);
            this.txt_giamdoccty.Name = "txt_giamdoccty";
            this.txt_giamdoccty.Size = new System.Drawing.Size(161, 21);
            this.txt_giamdoccty.TabIndex = 21;
            this.txt_giamdoccty.Validated += new System.EventHandler(this.txt_giamdoccty_Validated);
            this.txt_giamdoccty.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_giamdoccty_KeyDown);
            // 
            // label21
            // 
            this.label21.ForeColor = System.Drawing.Color.DarkBlue;
            this.label21.Location = new System.Drawing.Point(305, 61);
            this.label21.Name = "label21";
            this.label21.Size = new System.Drawing.Size(72, 23);
            this.label21.TabIndex = 39;
            this.label21.Text = "Website:";
            this.label21.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label22
            // 
            this.label22.ForeColor = System.Drawing.Color.DarkBlue;
            this.label22.Location = new System.Drawing.Point(305, 87);
            this.label22.Name = "label22";
            this.label22.Size = new System.Drawing.Size(72, 23);
            this.label22.TabIndex = 39;
            this.label22.Text = "Fax:";
            this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label6
            // 
            this.label6.ForeColor = System.Drawing.Color.DarkBlue;
            this.label6.Location = new System.Drawing.Point(17, 87);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(72, 23);
            this.label6.TabIndex = 39;
            this.label6.Text = "Điện thoại:";
            this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txt_tptochuc
            // 
            this.txt_tptochuc.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_tptochuc.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_tptochuc.Location = new System.Drawing.Point(130, 274);
            this.txt_tptochuc.Name = "txt_tptochuc";
            this.txt_tptochuc.Size = new System.Drawing.Size(163, 21);
            this.txt_tptochuc.TabIndex = 22;
            this.txt_tptochuc.Validated += new System.EventHandler(this.txt_tptochuc_Validated);
            this.txt_tptochuc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_tptochuc_KeyDown);
            // 
            // txtGiamdoc
            // 
            this.txtGiamdoc.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtGiamdoc.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtGiamdoc.Location = new System.Drawing.Point(130, 248);
            this.txtGiamdoc.Name = "txtGiamdoc";
            this.txtGiamdoc.Size = new System.Drawing.Size(163, 21);
            this.txtGiamdoc.TabIndex = 20;
            this.txtGiamdoc.Validated += new System.EventHandler(this.txtGiamdoc_Validated);
            this.txtGiamdoc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtGiamdoc_KeyDown);
            // 
            // txt_tylebh_bv
            // 
            this.txt_tylebh_bv.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_tylebh_bv.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_tylebh_bv.Location = new System.Drawing.Point(456, 138);
            this.txt_tylebh_bv.Name = "txt_tylebh_bv";
            this.txt_tylebh_bv.Size = new System.Drawing.Size(80, 21);
            this.txt_tylebh_bv.TabIndex = 11;
            this.txt_tylebh_bv.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_tylebh_bv_KeyPress);
            this.txt_tylebh_bv.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_tylebh_bv_KeyDown);
            // 
            // txt_tylebh_nv
            // 
            this.txt_tylebh_nv.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_tylebh_nv.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_tylebh_nv.Location = new System.Drawing.Point(456, 113);
            this.txt_tylebh_nv.Name = "txt_tylebh_nv";
            this.txt_tylebh_nv.Size = new System.Drawing.Size(80, 21);
            this.txt_tylebh_nv.TabIndex = 9;
            this.txt_tylebh_nv.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_tylebh_nv_KeyPress);
            this.txt_tylebh_nv.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_tylebh_nv_KeyDown);
            // 
            // txt_tylethuviec
            // 
            this.txt_tylethuviec.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_tylethuviec.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_tylethuviec.Location = new System.Drawing.Point(93, 138);
            this.txt_tylethuviec.Name = "txt_tylethuviec";
            this.txt_tylethuviec.Size = new System.Drawing.Size(102, 21);
            this.txt_tylethuviec.TabIndex = 10;
            this.txt_tylethuviec.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_tylethuviec_KeyPress);
            this.txt_tylethuviec.Validated += new System.EventHandler(this.txt_tylethuviec_Validated);
            this.txt_tylethuviec.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_tylethuviec_KeyDown);
            // 
            // txt_xephang
            // 
            this.txt_xephang.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txt_xephang.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txt_xephang.Location = new System.Drawing.Point(93, 113);
            this.txt_xephang.Name = "txt_xephang";
            this.txt_xephang.Size = new System.Drawing.Size(102, 21);
            this.txt_xephang.TabIndex = 8;
            this.txt_xephang.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_xephang_KeyDown);
            // 
            // diachi
            // 
            this.diachi.BackColor = System.Drawing.SystemColors.HighlightText;
            this.diachi.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.diachi.Location = new System.Drawing.Point(93, 61);
            this.diachi.Name = "diachi";
            this.diachi.Size = new System.Drawing.Size(200, 21);
            this.diachi.TabIndex = 4;
            this.diachi.KeyDown += new System.Windows.Forms.KeyEventHandler(this.diachi_KeyDown);
            // 
            // groupBox1
            // 
            this.groupBox1.Location = new System.Drawing.Point(0, 232);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(580, 10);
            this.groupBox1.TabIndex = 26;
            this.groupBox1.TabStop = false;
            // 
            // label17
            // 
            this.label17.ForeColor = System.Drawing.Color.DarkBlue;
            this.label17.Location = new System.Drawing.Point(6, 136);
            this.label17.Name = "label17";
            this.label17.Size = new System.Drawing.Size(83, 23);
            this.label17.TabIndex = 41;
            this.label17.Text = "Tỷ lệ lương TV:";
            this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label14
            // 
            this.label14.ForeColor = System.Drawing.Color.DarkBlue;
            this.label14.Location = new System.Drawing.Point(13, 113);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(76, 23);
            this.label14.TabIndex = 41;
            this.label14.Text = "Xếp hạng:";
            this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label15
            // 
            this.label15.ForeColor = System.Drawing.Color.DarkBlue;
            this.label15.Location = new System.Drawing.Point(357, 136);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(93, 23);
            this.label15.TabIndex = 41;
            this.label15.Text = "Của bệnh viện:";
            this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label12
            // 
            this.label12.ForeColor = System.Drawing.Color.DarkBlue;
            this.label12.Location = new System.Drawing.Point(254, 113);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(196, 23);
            this.label12.TabIndex = 41;
            this.label12.Text = "Tỷ lệ % đóng bảo hiểm của nhân viên :";
            this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label5
            // 
            this.label5.ForeColor = System.Drawing.Color.DarkBlue;
            this.label5.Location = new System.Drawing.Point(13, 59);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(76, 23);
            this.label5.TabIndex = 37;
            this.label5.Text = "Địa chỉ:";
            this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // chkATM
            // 
            this.chkATM.ForeColor = System.Drawing.Color.DarkBlue;
            this.chkATM.Location = new System.Drawing.Point(376, 162);
            this.chkATM.Name = "chkATM";
            this.chkATM.Size = new System.Drawing.Size(159, 24);
            this.chkATM.TabIndex = 14;
            this.chkATM.Text = "Trả lương bằng thẻ ATM";
            this.chkATM.KeyDown += new System.Windows.Forms.KeyEventHandler(this.chkATM_KeyDown);
            // 
            // benhvien
            // 
            this.benhvien.BackColor = System.Drawing.SystemColors.HighlightText;
            this.benhvien.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.benhvien.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.benhvien.Location = new System.Drawing.Point(377, 37);
            this.benhvien.Name = "benhvien";
            this.benhvien.Size = new System.Drawing.Size(190, 21);
            this.benhvien.TabIndex = 3;
            this.benhvien.KeyDown += new System.Windows.Forms.KeyEventHandler(this.benhvien_KeyDown);
            // 
            // label8
            // 
            this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label8.ForeColor = System.Drawing.Color.Red;
            this.label8.Location = new System.Drawing.Point(200, 163);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(51, 23);
            this.label8.TabIndex = 15;
            this.label8.Text = "đồng";
            this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // label4
            // 
            this.label4.ForeColor = System.Drawing.Color.DarkBlue;
            this.label4.Location = new System.Drawing.Point(305, 37);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(72, 23);
            this.label4.TabIndex = 35;
            this.label4.Text = "Bệnh viện:";
            this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label7
            // 
            this.label7.ForeColor = System.Drawing.Color.DarkBlue;
            this.label7.Location = new System.Drawing.Point(-7, 164);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(97, 23);
            this.label7.TabIndex = 43;
            this.label7.Text = "Lương tối thiểu:";
            this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // soyte
            // 
            this.soyte.BackColor = System.Drawing.SystemColors.HighlightText;
            this.soyte.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.soyte.Location = new System.Drawing.Point(93, 37);
            this.soyte.Name = "soyte";
            this.soyte.Size = new System.Drawing.Size(200, 21);
            this.soyte.TabIndex = 2;
            this.soyte.KeyDown += new System.Windows.Forms.KeyEventHandler(this.soyte_KeyDown);
            // 
            // txtltt
            // 
            this.txtltt.BackColor = System.Drawing.SystemColors.HighlightText;
            this.txtltt.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtltt.ForeColor = System.Drawing.Color.Red;
            this.txtltt.Location = new System.Drawing.Point(93, 165);
            this.txtltt.Name = "txtltt";
            this.txtltt.Size = new System.Drawing.Size(102, 22);
            this.txtltt.TabIndex = 12;
            this.txtltt.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtltt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtltt_KeyPress);
            this.txtltt.Validated += new System.EventHandler(this.txtltt_Validated);
            this.txtltt.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtltt_KeyDown);
            // 
            // label3
            // 
            this.label3.ForeColor = System.Drawing.Color.DarkBlue;
            this.label3.Location = new System.Drawing.Point(9, 35);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(80, 22);
            this.label3.TabIndex = 33;
            this.label3.Text = "Chủ quản:";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // chkVantay
            // 
            this.chkVantay.ForeColor = System.Drawing.Color.DarkBlue;
            this.chkVantay.Location = new System.Drawing.Point(257, 162);
            this.chkVantay.Name = "chkVantay";
            this.chkVantay.Size = new System.Drawing.Size(107, 24);
            this.chkVantay.TabIndex = 13;
            this.chkVantay.Text = "Quản lý vân tay";
            this.chkVantay.KeyDown += new System.Windows.Forms.KeyEventHandler(this.chkVantay_KeyDown);
            // 
            // maqu
            // 
            this.maqu.BackColor = System.Drawing.SystemColors.HighlightText;
            this.maqu.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.maqu.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.maqu.Location = new System.Drawing.Point(377, 13);
            this.maqu.Name = "maqu";
            this.maqu.Size = new System.Drawing.Size(190, 21);
            this.maqu.TabIndex = 1;
            this.maqu.KeyDown += new System.Windows.Forms.KeyEventHandler(this.maqu_KeyDown);
            // 
            // chkBarcode
            // 
            this.chkBarcode.ForeColor = System.Drawing.Color.DarkBlue;
            this.chkBarcode.Location = new System.Drawing.Point(257, 190);
            this.chkBarcode.Name = "chkBarcode";
            this.chkBarcode.Size = new System.Drawing.Size(107, 24);
            this.chkBarcode.TabIndex = 16;
            this.chkBarcode.Text = "Quản lý mã vạch";
            this.chkBarcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.chkBarcode_KeyDown);
            // 
            // label13
            // 
            this.label13.ForeColor = System.Drawing.Color.DarkBlue;
            this.label13.Location = new System.Drawing.Point(289, 13);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(88, 23);
            this.label13.TabIndex = 31;
            this.label13.Text = "Quận/Huyện:";
            this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.DarkBlue;
            this.label2.Location = new System.Drawing.Point(6, 18);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(84, 13);
            this.label2.TabIndex = 30;
            this.label2.Text = "Tỉnh/thành phố:";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // tabCtlThongso
            // 
            this.tabCtlThongso.Controls.Add(this.tabPage1);
            this.tabCtlThongso.Controls.Add(this.tabPage2);
            this.tabCtlThongso.Location = new System.Drawing.Point(7, 5);
            this.tabCtlThongso.Name = "tabCtlThongso";
            this.tabCtlThongso.SelectedIndex = 0;
            this.tabCtlThongso.Size = new System.Drawing.Size(579, 325);
            this.tabCtlThongso.TabIndex = 46;
            // 
            // frmThongso
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(607, 363);
            this.Controls.Add(this.tabCtlThongso);
            this.Controls.Add(this.cmdClose);
            this.Controls.Add(this.cmdOK);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.Opendata);
            this.Controls.Add(this.txtPath);
            this.Controls.Add(this.chkMang);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "frmThongso";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Khai báo thông số hệ thống";
            this.Load += new System.EventHandler(this.frmThongso_Load);
            this.tabPage2.ResumeLayout(false);
            this.tabPage2.PerformLayout();
            this.tabPage1.ResumeLayout(false);
            this.tabPage1.PerformLayout();
            this.tabCtlThongso.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

		private void frmThongso_Load(object sender, System.EventArgs e)
		{
            m_user = mDB.user;
            ds.ReadXml("..\\xml\\maincode.xml");
			DataTable dt = new  DataTable();			
			matt.DataSource=mDB.get_tinhthanh().Tables[0];
            matt.DisplayMember = "tentt";
            matt.ValueMember = "matt";
            matt.SelectedIndex = 0;
            loadquan(matt.SelectedValue.ToString());

            dt = mDB.get_benhvien().Tables[0];
			benhvien.DisplayMember="TENBV";
			benhvien.ValueMember="MABV";
			benhvien.DataSource=dt;
			benhvien.SelectedIndex=-1;
            if (mDB.Mabv != "")
            {
                //matt.SelectedValue = mDB.Matt.ToString();
            }
			//maqu.SelectedValue=mDB.Maqu.ToString();
			benhvien.SelectedValue=mDB.Mabv.ToString();
            foreach (DataRow r in mDB.get_data("select * from " + m_user + ".thongso order by id").Tables[0].Rows)
            {
                try
                {
                    switch (int.Parse(r["id"].ToString()))
                    {
                        case 0:
                            //matt.Enabled = r["ten"].ToString().Trim() == "0";
                            //maqu.Enabled = r["ten"].ToString().Trim() == "0";
                            //benhvien.Enabled = r["ten"].ToString().Trim() == "0";
                            break;
                        case 2:
                            matt.SelectedValue = mDB.Mabv.Substring(0, 3);
                            break;
                        case 4: soyte.Text = r["ten"].ToString().Trim();
                            break;
                        case 5: diachi.Text = r["ten"].ToString().Trim();
                            break;
                        case 6: dienthoai.Text = r["ten"].ToString().Trim();
                            break;
                        case 7:
                            chkMang.Checked = r["ten"].ToString().Trim() == "1";
                            break;
                        case 8: txtPath.Text = r["ten"].ToString().Trim();
                            break;
                        case 9: maqu.SelectedValue = r["ten"].ToString().Trim();
                            break;
                        case 10:
                            chkBarcode.Checked = r["ten"].ToString().Trim() == "1";
                            break;
                        case 11:
                            chkVantay.Checked = r["ten"].ToString().Trim() == "1";
                            break;
                        case 12:
                            txtltt.Text = r["ten"].ToString();
                            break;
                        case 13:
                            chkATM.Checked = r["ten"].ToString().Trim() == "1";
                            break;
                        case 14:
                            txtGiamdoc.Text = r["ten"].ToString();
                            break;
                        case 16:
                            chkdgkqcc.Checked = r["ten"].ToString().Trim() == "1";
                            break;
                        case 17:
                            {
                                try
                                {
                                    c138.Value = new System.DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(r["ten"].ToString().Substring(0, 2)), int.Parse(r["ten"].ToString().Substring(3)), 0);
                                }
                                catch
                                { }
                                break;
                            }
                        case 18:
                            txt_xephang.Text = r["ten"].ToString();
                            break;
                        case 19:
                            txt_giamdoccty.Text = r["ten"].ToString();
                            break;
                        case 20:
                            txt_tylebh_nv.Text = r["ten"].ToString();
                            break;
                        case 21:
                            txt_tylebh_bv.Text = r["ten"].ToString();
                            break;
                        case 22:
                            txt_tylethuviec.Text = r["ten"].ToString();
                            break;
                        case 24:
                            chk_cccuoituan.Checked = bool.Parse(r["ten"].ToString());
                            break;
                        case 26:
                            txt_website.Text = r["ten"].ToString();
                            break;                      
                        case 28:
                            txt_fax.Text = r["ten"].ToString();
                            break;
                        case 29:
                            txt_tptochuc.Text = r["ten"].ToString();
                            break;
                        case 30:
                            txt_nguoilb.Text = r["ten"].ToString();
                            break;
                        case 31:
                            {
                                try
                                {
                                    dtp_gioccchieu.Value = new System.DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(r["ten"].ToString().Substring(0, 2)), int.Parse(r["ten"].ToString().Substring(3)), 0);
                                }
                                catch
                                { }
                                break;
                            }
                        case 32:
                            chk_nhapmacc.Checked = r["ten"].ToString().Trim() == "1";
                            break;
                        case 33:
                            chk_cctructc.Checked = r["ten"].ToString().Trim() == "1";
                            break;
                    }
                }
                catch { }
            }
			Opendata.Enabled=chkMang.Checked;
		}

        public void loadquan(string matinh)
        {
            maqu.DisplayMember = "tenquan";
            maqu.ValueMember = "maqu";
            maqu.DataSource = mDB.get_data("select * from "+mDB.user+".btdquan where matt='" + matinh + "'").Tables[0];
        }

		private void matt_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			try
			{
                benhvien.DataSource = mDB.get_data("select * from "+mDB.user+".benhvien where substr(mabv,1,3)='" + matt.SelectedValue.ToString() + "'" + " order by mabv").Tables[0];
                loadquan(matt.SelectedValue.ToString());
                if (mDB.Mabv!="") benhvien.SelectedValue=mDB.Mabv;
			}
            catch(Exception ex)
            {
                string s = ex.Message;
            };			
		}

		private void cmdClose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void Opendata_Click(object sender, System.EventArgs e)
		{
			string sDir=System.Environment.CurrentDirectory.ToString();
			OpenFileDialog of=new OpenFileDialog();
			of.Filter="*.MDB|*.MDB";
            
			of.ShowDialog();
			txtPath.Text=of.FileName.ToString();
			System.Environment.CurrentDirectory=sDir;
		}

		private void chkMang_CheckedChanged(object sender, System.EventArgs e)
		{
			Opendata.Enabled= chkMang.Checked;
			txtPath.Text="Database\\nhansu.mdb";
		}
        string cc_cuoituan = "false";
		private void cmdOK_Click(object sender, System.EventArgs e)
		{
			if (matt.SelectedIndex==-1)
			{
				MessageBox.Show("Chọn tỉnh !");
				matt.Focus();
				return;
			}
			if (maqu.SelectedIndex==-1)
			{
                MessageBox.Show("Chọn qận !");
				maqu.Focus();
				return;
			}
            if (chk_cccuoituan.Checked == true)
            {
                cc_cuoituan = "true";
            }
            else
            {
                cc_cuoituan = "false";
            }
            ds.Tables[0].Rows[0]["Mabv"] = benhvien.SelectedValue.ToString();
            ds.Tables[0].Rows[0]["Tenbv"] = benhvien.Text;
            ds.Tables[0].Rows[0]["Syte"] = soyte.Text;
            ds.Tables[0].Rows[0]["Diachi"] = diachi.Text;// +" - " + maqu.Text + " - " + matt.Text;
            ds.Tables[0].Rows[0]["Dienthoai"] = dienthoai.Text;
            ds.Tables[0].Rows[0]["xephang"] = txt_xephang.Text;
            ds.Tables[0].Rows[0]["Giamdoc"] = txtGiamdoc.Text;
            ds.Tables[0].Rows[0]["Giamdoccty"] = txt_giamdoccty.Text;
            ds.Tables[0].Rows[0]["tylebh_nv"] = txt_tylebh_nv.Text;
            ds.Tables[0].Rows[0]["tylebh_bv"] = txt_tylebh_bv.Text;
            ds.Tables[0].Rows[0]["tyle_tv"] = txt_tylethuviec.Text;
            ds.Tables[0].Rows[0]["cc_cuoituan"] = chk_cccuoituan.Checked.ToString();
            ds.Tables[0].Rows[0]["website"] = txt_website.Text;
            ds.Tables[0].Rows[0]["fax"] = txt_fax.Text;
            ds.Tables[0].Rows[0]["tp_tochuc"] = txt_tptochuc.Text;
            ds.Tables[0].Rows[0]["pkhth"] = txt_nguoilb.Text;

			ds.WriteXml("..\\xml\\maincode.xml");
			if (matt.SelectedIndex!=-1)
				mDB.upd_thongso(2,benhvien.SelectedValue.ToString());
			if (benhvien.SelectedIndex!=-1)
				mDB.upd_thongso(3,benhvien.Text);
			mDB.upd_thongso(4,soyte.Text);
			mDB.upd_thongso(5,diachi.Text);
			mDB.upd_thongso(6,dienthoai.Text);
			mDB.upd_thongso(7,(chkMang.Checked)?"1":"0");
			mDB.upd_thongso(8,txtPath.Text);
			if (maqu.SelectedIndex!=-1)
				mDB.upd_thongso(9,maqu.SelectedValue.ToString());
			mDB.upd_thongso(10,(chkBarcode.Checked)?"1":"0");
			mDB.upd_thongso(11,(chkVantay.Checked)?"1":"0");
            mDB.upd_thongso(12, txtltt.Text);
            mDB.upd_thongso(13, (chkATM.Checked) ? "1" : "0");
            mDB.upd_thongso(14, txtGiamdoc.Text);
            mDB.upd_thongso(16, (chkdgkqcc.Checked) ? "1" : "0");
            mDB.upd_thongso(17, c138.Text);
            mDB.upd_thongso(18, txt_xephang.Text);
            mDB.upd_thongso(19, txt_giamdoccty.Text);
            mDB.upd_thongso(20, txt_tylebh_nv.Text);
            mDB.upd_thongso(21, txt_tylebh_bv.Text);
            mDB.upd_thongso(22, txt_tylethuviec.Text);
            mDB.upd_thongso(23, matt.SelectedValue.ToString());
            mDB.upd_thongso(24, cc_cuoituan);
            mDB.upd_thongso(26, txt_website.Text);
            mDB.upd_thongso(28, txt_fax.Text);
            mDB.upd_thongso(29, txt_tptochuc.Text);
            mDB.upd_thongso(30, txt_nguoilb.Text);
            mDB.upd_thongso(31, dtp_gioccchieu.Text);
            mDB.upd_thongso(32, (chk_nhapmacc.Checked) ? "1" : "0");
            mDB.upd_thongso(33, (chk_cctructc.Checked) ? "1" : "0");
			mDB.upd_thongso(0,"1");
			
			MessageBox.Show("Yêu cầu thoát khỏi chương trình sau đó vào lại !",AccessData.Msg);
			Application.Exit();
		}

        private void txtGiamdoc_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txtGiamdoc_Validated(object sender, EventArgs e)
        {
            txtGiamdoc.Text = txtGiamdoc.Text.ToUpper();
        }
        private void txt_giamdoccty_Validated(object sender, EventArgs e)
        {
            txt_giamdoccty.Text = txt_giamdoccty.Text.ToUpper();
        }
        private void txt_tptochuc_Validated(object sender, EventArgs e)
        {
            if (txt_tptochuc.Text != "")
                txt_tptochuc.Text = mDB.Caps(txt_tptochuc.Text);
        }

        private void txt_nguoilb_Validated(object sender, EventArgs e)
        {
            if (txt_nguoilb.Text != "")
                txt_nguoilb.Text = mDB.Caps(txt_nguoilb.Text);
        }
        private void matt_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}{F4}");
        }

        private void maqu_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void soyte_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}{F4}");
        }

        private void benhvien_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void diachi_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void dienthoai_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txt_xephang_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void chkBarcode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void chkVantay_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txtltt_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void chkATM_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void chkdgkqcc_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }
        private void chk_nhapmacc_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }
        private void chk_cctructc_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }     
        private void txt_giamdoccty_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }
        private void txt_tptochuc_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txt_nguoilb_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                cmdOK.Focus();
        }

        private void txt_website_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txt_fax_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }
        private void txt_tylebh_nv_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txt_tylebh_bv_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txt_tylethuviec_KeyDown(object sender, KeyEventArgs e)
        {
            if(e.KeyCode==Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void txt_tylebh_nv_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b' && e.KeyChar != '.')
                e.KeyChar = '\0';
        }

        private void txt_tylebh_bv_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b' && e.KeyChar != '.')
                e.KeyChar = '\0';
        }

        private void txt_tylethuviec_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b' && e.KeyChar != '.')
                e.KeyChar = '\0';
        }
        private void txtltt_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b' && e.KeyChar != '.')
                e.KeyChar = '\0';
        } 
        private void chk_cccuoituan_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void chk_cccuoituan_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_cccuoituan.Checked)
            {
                cc_cuoituan = "true";
            }
            else
            {
                cc_cuoituan ="false";
            }
        }

        private void txt_tylethuviec_Validated(object sender, EventArgs e)
        {
            if (txt_tylethuviec.Text.Trim() == "" || txt_tylethuviec.Text.Trim() == "0")
            {
                txt_tylethuviec.Text = "100";
            }
            else
            {
                txt_tylethuviec.Text = txt_tylethuviec.Text;
            }
        }

        private void txtltt_Validated(object sender, EventArgs e)
        {
            string sql = "";
            decimal ltt = 0;
            if(txtltt.Text.Trim()!="")
            {
                if(double.Parse(txtltt.Text.Trim())!= mDB.pltoithieu())
                {
                    if (MessageBox.Show("Đồng ý thay đổi mức lương tối cho tất cả nhân viên không?", AccessData.Msg, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            ltt = decimal.Parse(txtltt.Text.ToString());
                            sql = "update " + mDB.user + ".hopdong set luonghd=" + ltt.ToString();
                            mDB.Execute_data(sql);
                            sql = "update " + mDB.user + ".hopdong set luongct=hs_lc*" + ltt.ToString() + " ";
                            mDB.Execute_data(sql);
                        }
                        catch { }
                    }
                }
            }
            else
            {
                MessageBox.Show("Yêu cầu nhập mức lương tối thiểu","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                txtltt.Focus();
            }
        }

                  
	}
}
